package org.tao.lightningmq.nameserver.event.model;

import org.tao.lightningmq.common.dto.ServiceRegistryReqDTO;
import org.tao.lightningmq.common.event.model.BaseEvent;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author lht
 * @date 2025/1/7 - 20:01
 * @description:
 */
public class RegistryEvent extends BaseEvent {
    private String registryType;
    private String user;
    private String password;
    private String ip;
    private int port;
    private Map<String, Object> attrs = new HashMap<>();

    public RegistryEvent() {
    }

    public RegistryEvent(ServiceRegistryReqDTO serviceRegistryReqDTO) {
        this.setMsgId(serviceRegistryReqDTO.getMsgId());
        this.setPassword(serviceRegistryReqDTO.getPassword());
        this.setUser(serviceRegistryReqDTO.getUser());
        this.setAttrs(serviceRegistryReqDTO.getAttrs());
        this.setRegistryType(serviceRegistryReqDTO.getRegistryType());
    }

    public String getRegistryType() {
        return registryType;
    }

    public void setRegistryType(String registryType) {
        this.registryType = registryType;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public Object getAttr(String key) {
        return attrs.get(key);
    }

    public Map<String, Object> getAttrs() {
        return attrs;
    }

    public void setAttrs(Map<String, Object> attrs) {
        this.attrs = attrs;
    }
}
